package com.aaa.util;

import java.util.HashMap;
import java.util.Map;

import org.apache.http.HttpResponse;
import org.apache.http.util.EntityUtils;

public class SendCodeUtils {
	
	
	public  static  void send(String tel,String code) {
		
		String host = "https://zwp.market.alicloudapi.com";
	    String path = "/sms/sendv2";
	    String method = "GET";
	    String appcode = "415e2ef09de8450eb33ca6cafc648c2d";
	    Map<String, String> headers = new HashMap<String, String>();
	    //最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
	    headers.put("Authorization", "APPCODE " + appcode);
	    Map<String, String> querys = new HashMap<String, String>();
	    querys.put("content", "【云通知】您的验证码是"+code+"。如非本人操作，请忽略本短信");
	    querys.put("mobile", tel);

	    try {
	    	HttpResponse response = HttpUtils.doGet(host, path, method, headers, querys);
	    	System.out.println(EntityUtils.toString(response.getEntity()));
	    } catch (Exception e) {
	    	e.printStackTrace();
	    }
	}
	
	

}
